import request from "@/utils/request";

// 1.获取管理用户分页列表
export const reqUserList = (page, limit, searchParams) => {
  return request.get(`/admin/acl/user/${page}/${limit}`, {
    params: searchParams
  });
};

// 2.新增用户
export const reqAddUser = data => {
  return request.post(`/admin/acl/user/save`, data);
};

// 3.修改用户信息
export const reqUpdateUser = data => {
  return request.put("/admin/acl/user/update", data);
};

// 4.根据用户获取角色数据
export const reqRole = userId => {
  return request.get(`/admin/acl/user/toAssign/${userId}`);
};

// 5.给用户分配角色
export const reqAssign = (userId, roleIds) => {
  return request.post(
    `/admin/acl/user/doAssign?userId=${userId}&roleId=${roleIds}`
  );
};

//6.删除用户
export const reqDeleteUser = id => {
  return request.delete(`/admin/acl/user/remove/${id}`);
};

// 7.删除选中用户

export const reqDeleteSelectedUser = idList => {
  return request.delete("/admin/acl/user/batchRemove", { data: idList });
};
